package com.pengshun.modules.api.coal.result;

import com.fasterxml.jackson.annotation.JsonView;
import com.pengshun.modules.api.coal.service.dto.MerchantCoalInfoDto;
import com.pengshun.modules.common.ReslutView;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

@Data
public class MerchantCoalResult {

    @JsonView(ReslutView.aView.class)
    private Long merchantCoalId;
    @JsonView(ReslutView.aView.class)
    private Long merchantId;

    @JsonView(ReslutView.aView.class)
    private String coalName;
    @JsonView(ReslutView.aView.class)
    private String merchantName;
    private String laboratoryBillPic;
    @JsonView(ReslutView.aView.class)
    private String mineMouthName;
    private String detailAddress;
    private String linkmanPhone;
    @JsonView(ReslutView.aView.class)
    private BigDecimal sellPrice;

    @JsonView(ReslutView.aView.class)
    private BigDecimal coalNumber;
    @JsonView(ReslutView.aView.class)
    private String priceUnit;
    @JsonView(ReslutView.aView.class)
    private String coalPic;

    /**  发热量 */ @JsonView(ReslutView.aView.class)

    private String coalCalorific;

    /** 含水量 */
    @JsonView(ReslutView.aView.class)
    private String wholeWater;
    @JsonView(ReslutView.aView.class)
    private String serchHuifen;
    @JsonView(ReslutView.aView.class)
    private String swValue;

    /**  含硫量 */
    @JsonView(ReslutView.aView.class)
    private String sulphurContent;

    @JsonView(ReslutView.aView.class)
    private Integer distance;
    private Integer lowNumber;

    /**  商户类型 1自营 2直营 */
    @JsonView(ReslutView.aView.class)
    private Integer businessType;
    @JsonView(ReslutView.aView.class)
    private Integer level;
    @JsonView(ReslutView.aView.class)
    private Long coalId;
    private String laty;
    private String lngx;

    /**  距离 */
    @JsonView(ReslutView.aView.class)
    private String distances;

    public String getDistances() {
        if (distance != null) {
            distances = Math.round(distance/100/10)+"km";
        }
        return distances;
    }
    List<CategoryResult> categorys;
    private List<MerchantCoalInfoDto> merchantCoalInfos;

    public String getWholeWater() {
        wholeWater=wholeWater==null?"0%":wholeWater;
        return wholeWater;
    }

    public String getSulphurContent() {
        sulphurContent=sulphurContent==null?"0%":sulphurContent;
        return sulphurContent;
    }

}
